package com.example.demo.util;

public class ApiResult {
    private Integer code;
    private String message;
    private Object data;

    private ApiResult(Integer code,String message,Object data){
        super();
        this.code=code;
        this.message=message;
        this.data=data;
    }

    public static ApiResult success(Object data){
        return new ApiResult(200,"操作成功",data);
    }
    public static ApiResult erroor(){
        return new ApiResult(500,"操作失败","");
    }
    public static ApiResult error(String message){
        return new ApiResult(500,message,"");
    }
    public static ApiResult error(Integer code,String message){
        return new ApiResult(code,message,"");
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
